package imper.main.listener;

import java.util.ArrayList;
import java.util.List;

import imper.engine.entity.BuildFacilities;
import imper.engine.entity.CivilUnit;

import imper.engine.entity.FacilitiesType;

import imper.graphic.ButtonListener;
import imper.graphic.event.ClickEvent;

public class AddFacilitiesListener implements ButtonListener
{
	protected FacilitiesType _FacilitiesType;
	protected CivilUnit _CivilUnitSelect;

	public AddFacilitiesListener( FacilitiesType pFacilitiesType , CivilUnit pCivilUnitSelect )
	{
		this._FacilitiesType = pFacilitiesType;
		this._CivilUnitSelect = pCivilUnitSelect;
	}

	@Override
	public void click(ClickEvent pEvent)
	{
		List<BuildFacilities> buildFacilitiesSelect = new ArrayList<BuildFacilities>();
		buildFacilitiesSelect.add(new BuildFacilities(_FacilitiesType.getId(), _CivilUnitSelect.getPosX(), _CivilUnitSelect.getPosY()));
		_CivilUnitSelect.setBuildFacilities( buildFacilitiesSelect );
		_CivilUnitSelect.setTurnOff(1);
	}

}
